package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeInvoiceStatus;
import com.htgd.gardenexpo.dao.GeInvoiceStatusDao;
import com.htgd.gardenexpo.service.GeInvoiceStatusService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeInvoiceStatus)表服务实现类
 *
 * @author makejava
 * @since 2021-08-10 09:54:27
 */
@Service("geInvoiceStatusService")
public class GeInvoiceStatusServiceImpl implements GeInvoiceStatusService {
    @Resource
    private GeInvoiceStatusDao geInvoiceStatusDao;

    /**
     * 通过ID查询单条数据
     *
     * @param orderNum 主键
     * @return 实例对象
     */
    @Override
    public GeInvoiceStatus queryById(String orderNum) {
        return this.geInvoiceStatusDao.queryById(orderNum);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeInvoiceStatus> queryAllByLimit(int offset, int limit) {
        return this.geInvoiceStatusDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param geInvoiceStatus 实例对象
     * @return 实例对象
     */
    @Override
    public GeInvoiceStatus insert(GeInvoiceStatus geInvoiceStatus) {
        this.geInvoiceStatusDao.insert(geInvoiceStatus);
        return geInvoiceStatus;
    }

    /**
     * 修改数据
     *
     * @param geInvoiceStatus 实例对象
     * @return 实例对象
     */
    @Override
    public GeInvoiceStatus update(GeInvoiceStatus geInvoiceStatus) {
        this.geInvoiceStatusDao.update(geInvoiceStatus);
        return this.queryById(geInvoiceStatus.getOrderNum());
    }

    /**
     * 通过主键删除数据
     *
     * @param orderNum 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String orderNum) {
        return this.geInvoiceStatusDao.deleteById(orderNum) > 0;
    }
}
